package com.vhall.component.controller.interactive;

import com.alibaba.fastjson.JSONObject;
import com.vhall.component.controller.interactive.facade.QuestionAdmFacade;
import com.vhall.component.entity.interactive.vo.*;
import com.vhall.component.entity.page.vo.PageVO;
import com.vhall.component.framework.common.annotation.VhallComponent;
import com.vhall.component.plugin.common.annotation.TokenAuth;
import com.vhall.component.plugin.common.enums.OperateTypeEnum;
import com.vhall.component.service.annotation.OperateLog;
import com.vhall.component.service.interactive.QuestionAdminService;
import com.vhall.component.service.interactive.QuestionConsoleService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author guoxin.wang
 * @date 2021-06-10 15:18
 */
@VhallComponent
@TokenAuth("sys:question")
@Tag(name = "问卷列表-管理端")
public class QuestionAdmController implements QuestionAdmFacade {

    @Autowired
    private QuestionConsoleService questionConsoleService;

    @Autowired
    private QuestionAdminService questionAdminService;

    @Override
    @TokenAuth("sys:question:info")
    public QuestionConsoleCreateRspVO info(QuestionConsoleCreateReqVO reqVO) {
        return questionConsoleService.create(reqVO);
    }

    @Override
    @TokenAuth("sys:question:list")
    public PageVO<QuestionAdmRspVO> list(QuestionAdmListReqVO reqVO) {
        return questionAdminService.list(reqVO);
    }

    @Override
    @TokenAuth("sys:question:del")
    @OperateLog(type = OperateTypeEnum.DELETE, name = "删除问卷")
    public JSONObject delete(QuestionAdmDeleteReqVO reqVO) {
        questionAdminService.delete(reqVO);
        return new JSONObject();
    }

}
